DLLopen

@DLLopen LibName, FuncName[, ParamList][: ReturnType][; CallingConvention]

The ParamList is the prototype of the parameters expected by the function. This is optional and can be omitted. The format of the ParamList can be Param, Param, Param,...

where Param can be any of the following types: S (string), I (Integer), *I (Integer pointer), *N(double precision numeric pointer), L (long integer), *L (Long integer pointer).

The ReturnType is used to DECLARE the type of the parameter returned from the function. This can be omitted if required (e.g. if the DLL function is a PASCAL procedure). The type can be any of the following types: S, I, *N, L (see below).

Types

XpertRule C Pascal
S LPSTR pchar
I Int integer
*I Int far * var integer
*N Double far * var double (with the {$N+} flag in turbo)
L Long Longint

The optional CallingConvention parameter determines the DLL parameter calling convention to be used. This must be the same as the convention used in the DLL. If this parameter is omitted the default convention used is pascal. The possible parameters are P, C or S -

P : pascal

C : cDecl

S : stdCall

Examples:

@DLLopen 'MYDLL.DLL', 'MYPROC', I

@DLLopen 'MYDLL.DLL', 'MYPROC', I;P

Delphi

Procedure MYPROC(p1 : integer); export; pascal;

C

#define

DllExport __declspec (dllexport)

DllExport void __pascal MYPROC (int p1)

@DLLopen 'MYDLL.DLL' 'MYFUNC' S:I

@DLLopen 'MYDLL.DLL' 'MYFUNC' S:I;P

Delphi

Function MYFUNC(p1 : pchar) : integer; export; pascal;

C

#define

DllExport __declspec (dllexport)

DllExport int __pascal MYFUNC (LPSTR p1)

@DLLopen 'MYDLL.DLL' 'MYFUNC' S:I;C

Delphi

Function MYFUNC(p1 : pchar) : integer; export; cDecl;

C

#define

DllExport __declspec (dllexport)

DllExport int __cdecl MYFUNC (LPSTR p1)

@DLLopen 'MYDLL.DLL' 'MYFUNC' S:I;S

Delphi

Function MYFUNC(p1 : pchar) : integer; export; stdCall;

C

#define

DllExport __declspec (dllexport)

DllExport int __stdcall MYFUNC (LPSTR p1)

You cannot pass an array of type integer. To achieve this, pass the array as an array of type double (*N) and truncate the doubles within your DLL.